# frozen_string_literal: true

Rails.application.routes.draw do
  devise_for :users, ActiveAdmin::Devise.config
  ActiveAdmin.routes(self)
  # GraphQL
  mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql' if Rails.env.development?
  post '/graphql', to: 'graphql#execute'

  # Rest-API
  resources :variable_types, only: %i[index show create update destroy]
  resources :schemas, only: %i[index show create update destroy]
  resources :rules, only: %i[index show create update destroy]

  post 'rules/validate_by_uuid', to: 'rules#validate_by_uuid'
  post 'rules/fire', to: 'rules#fire'

  resources :rule_entities do
    member do
      post 'validate'
      post 'deploy'
      post 'fire'
    end
  end
end
